-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add iotools functions for Meteonorm #2499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things here and there. Otherwise LGTM!
Co-authored-by: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com>
Co-authored-by: Ioannis Sifnaios <88548539+IoannisSifnaios@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, my name is Mathias, and I'm a developer of the Meteonorm API. First of all, thanks for creating pvlib
; it's a very nice library we often use for reference. We're excited to see Meteonorm being integrated. @AdamRJensen reached out to us, and I'm here to review the merge request.
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
iotools.get_meteonorm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Solcast there are specialized functions for retrieving TMY, historical and forecast data. For Meteonorm there is currently only a TMY and a "everthing else" getter function (for the endpoints /observation/training
, /observation/realtime
, /forecast/basic
, and /forecast/precision
). What's the reasoning behind implementing get_meteonorm
instead of get_meteonorm_observation_training
, get_meteonorm_observation_realtime
, get_meteonorm_forecast_basic
, and get_meteonorm_forecast_precision
? There are pros and cons for both variants, but i would argue, that for the end user it's easier if there's a specialized function for every endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be convinced to have a separate function for get_meteonorm_observation
and get_meteonorm_forecast
with a keyword parameter to switch between the subcases. The main motivation is to reduce the duplicate docstring and reduce the maintenance burden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the right answer here is. Maybe @AdamRJensen's proposal is the best balance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I see that this is a maintenance nightmare with doc-strings of this size.
I assume messing around with the __doc__
field to share a part of the documentation is not really an option; this becomes unreadable very fast.
Despite that, every request to the API costs the user real money and thus I'm critical about using parameters - instead of separate functions - to decide which endpoint to call.
[...] keyword parameter to switch between the subcases.
@AdamRJensen How would this look like? One option would be to use the exact same signature but the value to the parameter endpoint
has to be "basic"
/"precision"
for get_meteonorm_forecast
and "realtime"
/"training"
for get_meteonorm_observation
.
Note that there is no parameter frequency
for the /forecast/basic
endpoint, thus it would be a good idea to raise a warning or exception if the user uses endpoint="basic", time_step="1min"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AdamRJensen How would this look like? One option would be to use the exact same signature but the value to the parameter
endpoint
has to be"basic"
/"precision"
forget_meteonorm_forecast
and"realtime"
/"training"
forget_meteonorm_observation
. Note that there is no parameterfrequency
for the/forecast/basic
endpoint, thus it would be a good idea to raise a warning or exception if the user usesendpoint="basic", time_step="1min"
.
@maschwanden If we are to split it into separate forecast and observation functions, then this is exactly how I envisioned it. I'm curious what other members of @pvlib/pvlib-maintainer have to say about this.
Also, I've added an error message if the basic forecast is requested with a frequency other than '1_hour'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maschwanden Check out the changes in the last commit. Would this approach be ok with you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, @maschwanden proposed meteonorm.get_meteonorm_observation_training
is similar to the existing solcast.get_solcast_historic
function and the meteonorm.get_meteonorm_observation_realtime
is similar to the solcast.get_solcast_live
function. I would favor API parallelism over concerns about docstrings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only read the code (did not try it myself).
.. autosummary:: | ||
:toctree: generated/ | ||
|
||
iotools.get_meteonorm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the right answer here is. Maybe @AdamRJensen's proposal is the best balance.
docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.This PR adds functions for retrieving irradiance and weather data from Meteonorm. This is the last function I plan on contributing to the commercial iotools, as pvlib then will support what I consider the major providers of satellite-derived irradiance data.
Documentation:
For anyone willing to review this PR, I can provide a temporary API key.